﻿using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
using System.IO;
using System.Xml.Serialization;

namespace Advanced_Terrain
{
    [Serializable]
    public class CustomDiscList
    {
        private List<CustomDisc> _DiscInfo = new List<CustomDisc>();
        public List<CustomDisc> DiscInfo
        {
            get { return _DiscInfo; }
            set { _DiscInfo = value; }
        }
        public CustomDiscList()
        {

        }
        public void SaveMe(string FileName)
        {
            // Get the path of the save game
            string fullpath = Path.Combine(StorageContainer.TitleLocation, FileName);

            // Open the file, creating it if necessary
            FileStream stream = File.Open(fullpath, FileMode.OpenOrCreate);
            try
            {
                // Convert the object to XML data and put it in the stream
                XmlSerializer serializer = new XmlSerializer(typeof(CustomDiscList));
                serializer.Serialize(stream, this);
            }
            finally
            {
                // Close the file
                stream.Close();
            }

        }
        public CustomDiscList LoadMe(string FileName)
        {
            Stream stream = File.OpenRead(FileName);
            XmlSerializer serializer = new XmlSerializer(typeof(CustomDiscList));
            return (CustomDiscList)serializer.Deserialize(stream);

        }

    }
}
